﻿using DropBoxClient.Entities;
using DropBoxClient.Framework;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO;
using System.Linq;
using System.Net;
using System.Runtime.Serialization.Json;
using System.Text;

namespace DropBoxClient.Operations
{
    internal class PostDeltaOperation
    {
        private static readonly string Url = "https://api.dropbox.com/1/delta";
        private static readonly string MethodType = StringConstants.PostMethodType;

        private WebOperation<DropBoxState> _operation;
        private string _accessToken;

        internal string Cursor { get; set; }

        internal PostDeltaOperation(string accessToken)
        {
            _accessToken = accessToken;
        }

        internal DropBoxState Execute()
        {
            var parameters = new NameValueCollection();
            parameters.Add("cursor", Cursor);
            _operation = new WebOperation<DropBoxState>(Url, _accessToken, MethodType, parameters);
            return _operation.Execute();
        }
    }
}
